<template>
    <h1>欢迎来到 Lu Shengcan 的下载站</h1>
    <ul>
        <li v-for="file in files" :key="file.name">
            {{ file.name }}
        </li>
    </ul>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import axios from 'axios'

const files = ref([])
const error = ref(null)
const loading = ref(true)

async function fetchData() {
    try {
        const response = await axios.get('http://localhost:5000/download/');
        files.value = response.data.files;
    } catch (error) {
        error.value = error.message;
    } finally {
        loading.value = false;
    }
}

onMounted(fetchData)

</script>